package com.zzptc.tkfate;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    ListView listView;
    List<Date> list;
    ListView tv_id,tv_name,tv_toatl,tv_status,tv_time;
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setContentView(R.layout.activity_main);
        listView=findViewById(R.id.lv_fafa);
        list=new ArrayList<>();
        Date date=new Date(1,"搞如此大型的巡演",195.1f,"2019-3-5",1);
        Date date1=new Date(2,"物流目前在我们",456.1f,"2019-6-8",2);
        Date date2=new Date(3,"物流对海尔的发展",366.1f,"2019-3-8",3);
        Date date3=new Date(4,"区域物流网络建设的重点",466.1f,"2019-9-8",4);
        Date date4=new Date(5,"对装备物流及其理论体系的研究",966.1f,"2019-8-4",5);

        list.add(date);
        list.add(date1);
        list.add(date2);
        list.add(date3);
        list.add(date4);

        MyAdapter myAdapter=new MyAdapter();
        listView.setAdapter(myAdapter);
    }
    class MyAdapter extends BaseAdapter {
        @Override
        public int getCount() {

            return list.size();
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            Date date=list.get(position);
            View v = View.inflate(MainActivity.this, R.layout.item, null);
            TextView tv_id=v.findViewById(R.id.tv_id);
            tv_id.setText(date.getO_id()+"");
            TextView iv_name=v.findViewById(R.id.tv_name);
            iv_name.setText(date.getO_name()+"");
            TextView tv_status=v.findViewById(R.id.tv_status);
            tv_status.setText(date.getO_status()+"");
            TextView tv_time=v.findViewById(R.id.tv_time);
            tv_time.setText(date.getO_time()+"");
            TextView tv_toatl=v.findViewById(R.id.tv_toatl);
            tv_toatl.setText(date.getO_toatl()+"");
            return v;
        }

    }
}
